typedef struct _gui {
	int		col;
	int		row;

	int		num_cols;
	int		num_rows;

	int		char_width;
	int		char_height;

	GuiFont	norm_font;

	GuiFont	currFont;
	guicolor_T	currFgColor;
	guicolor_T	currBgColor;
	guicolor_T	currSpColor;
} gui_T;

typedef struct {
	int x;
	int y;
} pos_T;


typedef struct {
	int		lnum;
	int		start;
	int		end;
} segement_T;

typedef struct {
	int top;
	int left;
	int bottom;
	int right;
} PvCRect;

typedef struct {
	char_utf16	*tb_buf;
	int			tb_buf_len;
	int			tb_len;
} typebuf_T;

typedef struct {
	PyObject_HEAD
	PyObject	*lines;
	PyObject	*ffname;	/* full path file name */
	PyObject	*bname;	/* file base name */
	PyObject	*name;		/* buffer name */
	PyObject	*encoding;
	PyObject	*linebr;	/* line breaker, default value is '\n' */
} PvBufferObject;

typedef struct {
	PyObject_HEAD
	Py_UNICODE	*buf;
	int			rows;
	int			cols;
} PvScreenBuffer;

typedef struct {
	PyObject_HEAD
	int			layout;
	PyObject	*parent;
	PyObject	*prev;		/* sibling frame of same parent, NULL for first */
	PyObject	*next;		/* sibling frame of same parent, NULL for last */
	PyObject	*child;		/* first contained frame */
	PyObject	*win;
	int			top;
	int			left;
	int			width;
	int			height;
} PvFrame;

typedef struct {
	PyObject_HEAD
	PyObject	*buffer;
	PyObject	*frame;

	int			row;		/* the row pos at buffer **not for window** */
	int			col;		/* the col pos at buffer **not for window** */
	int			wantcol;	/* this variable store the absolute pos of col you want move to */
							/* used when cursor move up or move down */
	int			wcol;		/* cache for absolute pos of col, 
							   and absolute pos row always equal buffer row */
	int			topline; 
	int			leftcol;
	int			top;
	int			height;
	int			status_height;
	int			left;
	int			width;
	int			vsep_width;

	Py_UNICODE	*lines;

	int			tabstop;

	int			mode;
} PvWindow;

typedef struct {
	PyObject_HEAD
	PyObject	*topframe;
	PyObject	*curframe;
	PyObject	*screen_buf;

	int		width;
	int		height;

	int		cols;
	int		rows;

	int		char_width;
	int		char_height;

	int		cmd_lines;
} PvScreen;

typedef struct {
	PyObject_HEAD
	PyObject	*segments;
} PvSegments;

